home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 17 / CU Amiga Magazine's Super CD-ROM 17 (1997)(EMAP Images)(GB)[!][issue 1997-12].iso / CDsupport / IDer / Routines / ParseConfig.s < prev    next >
Text File  |  1997-02-18  |  2KB  |  78 lines

  1. ParseConfig:    Lea    EntryTable(PC),A5    ;list of entries available to be included
  2.     Moveq    #0,D2
  3. .ParseLoop    Move.L    (A5)+,A3        ;get the next entry in the table
  4.     Cmp.L    #-1,A3        ;is it the last entry
  5.     Beq.S    .ParsingDone
  6.     Bsr.S    .ParseEntry        ;process the entry
  7.     Bra.S    .ParseLoop
  8.  
  9. .ParsingDone    Moveq    #1,D2
  10. .ParseLoop2    Move.L    (A5)+,A3        ;get the next entry in the table
  11.     Cmp.L    #-1,A3        ;is it the last entry
  12.     Beq.S    .ParsingDone2
  13.     Bsr.S    .ParseEntry        ;process the entry
  14.     Bra.S    .ParseLoop2
  15.  
  16. .ParsingDone2    Lea    _Action(PC),A3
  17.     Moveq    #-1,D2
  18.     Bsr.S    .ParseEntry
  19.  
  20. ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  21.     Lea    ConfigLine,A0        ;the parser put -1's in to break up the
  22.     Move.L    #1023,D1        ;entries.  If I had put 0's there, the
  23. .Cleanup    Move.B    (A0),D0        ;parser would have thrown a wobbly
  24.     Beq.S    .CleanupDone
  25.     Cmp.B    #-1,D0        ;so I must now go through and convert
  26.     Bne.S    .NotNeg        ;all -1's into 0's, so the the main
  27.     Moveq    #0,D0        ;routines can work properly
  28. .NotNeg    Move.B    D0,(A0)+
  29.     DBra    D1,.Cleanup
  30. .CleanupDone    Rts
  31.  
  32. ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  33. .ParseEntry    Cmp.B    #1,D2
  34.     Beq.S    .NoAbbrev
  35.  
  36.     Lea    SearchString(PC),A4    ;this string is for using an abbreviated version of the full identifier
  37.  
  38.     Move.B    4(A3),1(A4)        ;get first character for abbreviated string
  39.  
  40.     Move.L    A4,A0        ;the string to look for
  41.     Lea    ConfigLine,A1        ;the class entry to go looking through
  42.     Bsr    FindData        ;try and find the data
  43.     Tst.L    D0
  44.     Beq.S    .EntryFound
  45.  
  46. .NoAbbrev    Lea    4(A3),A0        ;the full identifier.  This is if the abbreviated version failed
  47.     Lea    ConfigLine,A1        ;the line copied from the config file.
  48.     Bsr    FindData
  49.     Tst.L    D0
  50.     Bne.S    .NoEntry
  51.  
  52. .EntryFound    Move.B    #-1,-1(A0)        ;mark the start of the entry, by seperating it from the other's
  53.     Move.L    A1,(A3)        ;return the pointer of the data after the identifier
  54.     Cmp.B    #-1,D2
  55.     Beq.S    .WSpaceDone
  56.  
  57.     Moveq    #0,D0
  58.     Moveq    #0,D1
  59. .WSpaceLoop    Move.B    (A1)+,D0
  60.     Beq.S    .WSpaceDone
  61.     Cmp.B    #'\"',D0
  62.     Bne.S    .NotQuote
  63.     Not.B    D1
  64.     Bra.S    .WSpaceLoop
  65. .NotQuote    Cmp.B    #' ',D0
  66.     Bne.S    .NotSpace
  67.     Tst.B    D1
  68.     Beq.S    .WSpaceEnd
  69. .NotSpace    Cmp.B    #'\t',D0
  70.     Bne.S    .WSpaceLoop
  71.     Tst.B    D1
  72.     Bne.S    .WSpaceLoop
  73. .WSpaceEnd    Move.B    #-1,-1(A1)
  74. .WSpaceDone    Rts
  75.  
  76. .NoEntry    Clr.L    (A3)        ;if no entry was found, clear the data from the previous usages
  77.     Rts
  78.